"use strict";
cc._RF.push(module, 'dee87aY2OlJa7UjoURnTOnG', 'GameLandPhyControl');
// scripts/GameLandPhyControl.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});
var r = t("GameConstant"),
    s = t("GameLogic"),
    l = cc._decorator,
    c = l.ccclass,
    d = (l.property, function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e._gameLogic = new s.GameLogic(), e._gameControl = null, e.bCollider = !1, e.bLBodyCollider = !1, e.bLWheel0Collider = !1, e.bLWheel1Collider = !1, e.bRBodyCollider = !1, e.bRWheel0Collider = !1, e.bRWheel1Collider = !1, e;
  }

  return n(e, t), e.prototype.init = function (t) {
    this._gameControl = t;
  }, e.prototype.onGameStart = function () {
    this.resetData(), this.bCollider = !0;
  }, e.prototype.onGameOver = function () {
    this.bCollider = !1, this.resetData();
  }, e.prototype.onGameBoutStart = function () {
    this.resetData(), this.bCollider = !0;
  }, e.prototype.onGameBoutOver = function () {
    this.resetData(), this.bCollider = !1;
  }, e.prototype.resetData = function () {
    this.bLBodyCollider = !1, this.bLWheel0Collider = !1, this.bLWheel1Collider = !1, this.bRBodyCollider = !1, this.bRWheel0Collider = !1, this.bRWheel1Collider = !1, this._gameControl.setCanTouchBtn(r.Collide_Car_Tag.Left, !1), this._gameControl.setCanTouchBtn(r.Collide_Car_Tag.Right, !1);
  }, e.prototype.onBeginContact = function (t, e, o) {
    if (this.bCollider) {
      var i = this._gameLogic.getColliderCarTag(o.tag);

      if (o.node.group == r.Collide_Group_Car.body) this.onEnterCarBody(i);else if (o.node.group == r.Collide_Group_Car.wheel) {
        var n = this._gameLogic.getColliderWheelTag(o.tag);

        this.onEnterCarWheel(i, n);
      }
    }
  }, e.prototype.onEnterCarBody = function (t) {
    r.Collide_Car_Tag.Left == t ? this.bLBodyCollider = !0 : r.Collide_Car_Tag.Right == t && (this.bRBodyCollider = !0), this.isCarEnterLand(t);
  }, e.prototype.onEnterCarWheel = function (t, e) {
    r.Collide_Car_Tag.Left == t ? r.Physics_Body_Tag.Wheel0 == e ? this.bLWheel0Collider = !0 : r.Physics_Body_Tag.Wheel1 == e && (this.bLWheel1Collider = !0) : r.Collide_Car_Tag.Right == t && (r.Physics_Body_Tag.Wheel0 == e ? this.bRWheel0Collider = !0 : r.Physics_Body_Tag.Wheel1 == e && (this.bRWheel1Collider = !0)), this.isCarEnterLand(t);
  }, e.prototype.onExitCarBody = function (t) {
    r.Collide_Car_Tag.Left == t ? this.bLBodyCollider = !1 : r.Collide_Car_Tag.Right == t && (this.bRBodyCollider = !1), this.isCarExitLand(t);
  }, e.prototype.onExitCarWheel = function (t, e) {
    r.Collide_Car_Tag.Left == t ? r.Physics_Body_Tag.Wheel0 == e ? this.bLWheel0Collider = !1 : r.Physics_Body_Tag.Wheel1 == e && (this.bLWheel1Collider = !1) : r.Collide_Car_Tag.Right == t && (r.Physics_Body_Tag.Wheel0 == e ? this.bRWheel0Collider = !1 : r.Physics_Body_Tag.Wheel1 == e && (this.bRWheel1Collider = !1)), this.isCarExitLand(t);
  }, e.prototype.isCarEnterLand = function (t) {
    r.Collide_Car_Tag.Left == t ? (this.bLBodyCollider || this.bLWheel0Collider || this.bLWheel1Collider) && this._gameControl.setCanTouchBtn(t, !0) : r.Collide_Car_Tag.Right == t && (this.bRBodyCollider || this.bRWheel0Collider || this.bRWheel1Collider) && this._gameControl.setCanTouchBtn(t, !0);
  }, e.prototype.isCarExitLand = function (t) {
    r.Collide_Car_Tag.Left == t ? this.bLBodyCollider || this.bLWheel0Collider || this.bLWheel1Collider || this._gameControl.setCanTouchBtn(t, !1) : r.Collide_Car_Tag.Right == t && (this.bRBodyCollider || this.bRWheel0Collider || this.bRWheel1Collider || this._gameControl.setCanTouchBtn(t, !1));
  }, a([c], e);
}(cc.Component));
o["default"] = d;

cc._RF.pop();